(function () {
  let t = null
  $.fn.lazyLoad = function () {
    let _this = this
    function lazyLoad() {
      if (t) clearTimeout(t)
      t = setTimeout(() => {
        let wH = window.innerHeight || document.documentElement.clientHeight
        let sH = document.body.scrollTop || document.documentElement.scrollTop
        let showH = wH + sH
        let imgs = _this
        for (let i = 0; i < imgs.length; i++) {
          if (imgs[i].offsetTop < showH) {
            if (imgs[i].offsetTop < showH) {
              imgs[i].src = imgs[i].getAttribute('data-src')
            }
          }
        }
      }, 500)
    }
    lazyLoad()
    window.onscroll = lazyLoad
  }
})(window)